home *** CD-ROM | disk | FTP | other *** search
- Path: polarnet.com!floyd
- From: floyd@polarnet.com (Floyd Davidson)
- Newsgroups: comp.lang.c
- Subject: Re: HELP - why isn't ld working
- Date: 4 Feb 1996 21:57:11 GMT
- Organization: __________
- Message-ID: <4f3a3n$5nc@zippy.cais.net>
- References: <4etai7$22s@deadbird.db.erau.edu> <4f0kgb$6gj@umbc9.umbc.edu>
- Reply-To: floyd@tanana.polarnet.com
- NNTP-Posting-Host: tanana.polarnet.com
-
- In article <4f0kgb$6gj@umbc9.umbc.edu>,
- Jonas J. Schlein <schlein@umbc.edu> wrote:
- >Darryl E. Marsee <marseed@news.db.erau.edu> wrote:
- >|> gcc ex5.c ex5a.c
- >|>
- >|> It produces a correctly executing a.out. So far so good.
- ..
- >|> gcc -c ex5.c
- >|> gcc -c ex5a.c
- ...
- >|> ld ex5.o ex5a.o -lc
- >
- >Tell him don't do that ;-). Either stick with the first way or instead of
- >using ld use gcc with the command line:
- >
- >gcc ex5.o ex5a.o
-
- True enough, but why not at least give someone an idea of what
- is going on! The command "gcc ex5.o ex5a.o" does a lot more
- than just call ld as "ld ex5.o ex5a.o -lc", and knowing what it
- actually does might clear up a lot of confusion about the why
- and when of various gcc command lines.
-
- Darryl, try these to command lines to see what is happening, and
- then you can post questions about what it is doing:
-
- gcc -v ex5.c ex5a.c
-
- and
-
- gcc -c ex5.c
- gcc -c ex5a.c
- gcc -v ex5.o ex5a.o
-
- The -v will cause verbose output from gcc, which means it will
- show you the command lines it uses to call other programs,
- including ld. If nothing else it will convince you that calling
- ld directly isn't as easy as using gcc to do it for you! For
- example:
-
- tanana:floyd /tmp >gcc -v xx.o
- Reading specs from /usr/lib/gcc-lib/i486-linux/2.7.0/specs
- gcc version 2.7.0
- /usr/i486-linux/bin/ld -m elf_i386 -dynamic-linker \
- /lib/ld-linux.so.1 /usr/lib/crt1.o /usr/lib/crti.o \
- /usr/lib/crtbegin.o -L/usr/lib/gcc-lib/i486-linux/2.7.0 \
- -L/usr/i486-linux/lib xx.o -lgcc -lc -lgcc /usr/lib/crtend.o \
- /usr/lib/crtn.o
-
- (The '\' characters are where I have wrapped the lines.)
-
- Floyd
-
- --
- Floyd L. Davidson Salcha, Alaska floyd@tanana.polarnet.com
-